<template lang="pug">
  .clearfix
    Modal(
      width="300"
      v-model="isShowInquiryModal"
      title="是否确认年审调基"
      class-name="vertical-center-modal"
    )
      //- Row
      //-   Col.pl-10.mb-10(span="24") 请选择普调时间：
      //-   Col.pl-10(span="24")
      //-     DatePicker.w-100(v-model="effectTime" placeholder="请选择" type="month" format="yyyy-MM")
      .search-form.pt-20
        Form.ivu-row.ivu-form-basic(ref="formData" :model="formData" :label-width="90")
          FormItem.form-item.ivu-col.pr-20.mb-15(v-for="(item, index) of formItem" :label="item.label" :key="index" :class="item.style" :prop="item.prop")
            template(v-if="item.type === 'datePicker'")
              DatePicker.w-100(v-model="formData[item.model]" :placeholder="item.placeholder" type="date" format="yyyy-MM-dd")

      .clearfix(slot="footer")
        Button(type="text" @click="cancel") 取消
        Button(type="primary" @click="handleSubmit") 确定
</template>

<script>
import { Common } from '@/utils/common.js'
import { YearReviewBaseAmountApi } from '@/api/YearReviewBaseAmount.api.js'
export default {
  name: '',

  props: {
  },

  data () {
    return {
      isShowInquiryModal: false,
      ids: null,
      effectTime: null,
      formData: {
        effectTime: ''
      },
      formItem: [
        { type: 'datePicker', label: '生效时间：', placeholder: '请选择生效时间', prop: 'effectTime', model: 'effectTime', style: 'ivu-col-span-md-24' },
      ],
    }
  },

  watch: {
  },

  mounted () {
  },

  methods: {
    cancel () {
      this.isShowInquiryModal = false
    },

    show () {
      this.$refs.formData.resetFields()
      this.isShowInquiryModal = true
    },

    // 确定
    async handleSubmit () {
      var params = {
        Ids: this.ids,
        EffectTime: this.$moment(this.formData.effectTime).format('YYYY-MM-DD')
      }
      let res = await YearReviewBaseAmountApi.batchAdjustment(params)
      console.log('res: ', res)
      if (res.status === 200 && res.data.success) {
        this.$Message.success(res.data.message)
        this.$emit('query')
        this.isShowInquiryModal = false
      } else {
        this.$Message.error({
          content: res.data.message,
          duration: 10,
          closable: true
        })
      }
    }
  }
}
</script>

<style lang="less" scope>
</style>
